package com.lz.spring.cloud.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;

/**
 * Java代码的方式自定义Ribbon
 * @author likejian
 *
 */
@Configuration
public class MyRibbonConfiguration {

	@Autowired
	IClientConfig config;
	
	@Bean
    public IRule ribbonRule(IClientConfig config) {
        return new RandomRule();
        //return new RoundRobinRule();
    }
}
